﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class major_590202_ResourceList : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Request.QueryString["cid"] == null)
        {
            SqlDataSource1.SelectCommand = "SELECT [Resource_Name], [Resource_ID], [Resource_Type], Replace([Resource_TypeName],'应用电子技术->','') [Resource_TypeName], [Resource_AddDate], [Resource_Visit],[Resource_Size] FROM [zyk_Resources] WHERE [Resource_Type] like '%{'+@Resource_Type+'}%' ORDER BY [Resource_AddDate] DESC";
            SqlDataSource1.SelectParameters.Clear();
            SqlDataSource1.SelectParameters.Add("Resource_Type", Request.QueryString["rstype"].ToString());
        }
        else
        {
            SqlDataSource1.SelectCommand = "SELECT [Resource_Name], [Resource_ID], [Resource_Type], Replace([Resource_TypeName],'应用电子技术->','') [Resource_TypeName], [Resource_AddDate], [Resource_Visit],[Resource_Size] FROM [zyk_Resources] WHERE [Resource_Type] like '%{'+@Resource_Type+'}%' and exists (select * from zyk_RCR where RCR_ResourceID=Resource_ID and   RCR_CourseID=@courseid)ORDER BY [Resource_AddDate] DESC";
            SqlDataSource1.SelectParameters.Clear();
            SqlDataSource1.SelectParameters.Add("Resource_Type", Request.QueryString["rstype"].ToString());
            SqlDataSource1.SelectParameters.Add("courseid", Request.QueryString["cid"].ToString());
        }
    }
}
